﻿#region << 文 件 说 明 >>
/*----------------------------------------------------------------
// 文件名称：ModelPoco
// 创 建 者：杨程
// 创建时间：2021/9/23 15:06:59
// 文件版本：V1.0.0
// ===============================================================
// 功能描述：
//		
//
//----------------------------------------------------------------*/
#endregion

using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vampirewal.Core.Models;

namespace V.CodeGenerator.CreateCodes.Model
{
    /// <summary>
    /// 实体类
    /// </summary>
    [SugarTable("CodeGenerator_ModelPoco")]
    public class ModelPoco:BillBaseModel
    {
        public ModelPoco()
        {
            //构造函数
            ModelDtlPocos = new List<ModelDtlPoco>();
        }

        #region 属性

        /// <summary>
        /// 数据库表名
        /// </summary>
        public string TableName { get; set; }

        /// <summary>
        /// 模型名称
        /// </summary>
        public string ClassName { get; set; }

        /// <summary>
        /// 模型类型
        /// </summary>
        public ModelType modelType { get; set; }
        /// <summary>
        /// 继承基类名称
        /// </summary>
        public string InheritanceBaseModel { get; set; }

        /// <summary>
        /// 模型展示名称
        /// </summary>
        public string DisplayName { get; set; }

        /// <summary>
        /// 模型包含的属性
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public List<ModelDtlPoco> ModelDtlPocos { get; set; }
        #endregion

        #region 扩展
        /// <summary>
        /// 对应工程
        /// </summary>
        public string ProjectPocoId { get; set; }
        /// <summary>
        /// 模块ID
        /// </summary>
        public string ModuleId { get; set; }

        /// <summary>
        /// 功能ID
        /// </summary>
        public string FunctionId { get; set; }
        #endregion

    }

    /// <summary>
    /// 字段模型
    /// </summary>
    [SugarTable("CodeGenerator_ModelDtlPoco")]
    public class ModelDtlPoco : DetailBaseModel
    {
        /// <summary>
        /// 对应modelID
        /// </summary>
        public string ModelPocoId { get; set; }
        /// <summary>
        /// 字段名称
        /// </summary>
        public string PropName { get; set; }

        /// <summary>
        /// 字段描述
        /// </summary>
        public string PropDes { get; set; }

        /// <summary>
        /// 字段类型
        /// </summary>
        public string propType { get; set; }

        /// <summary>
        /// 字段长度
        /// </summary>
        public int PropLength { get; set; }

        /// <summary>
        /// 最小值
        /// </summary>
        public int MinValue { get; set; }

        /// <summary>
        /// 最大值
        /// </summary>
        public int MaxValue { get; set; }

        /// <summary>
        /// 字段精度
        /// </summary>
        public int PropPrecision { get; set; }

        /// <summary>
        /// 是否必填
        /// </summary>
        public bool IsRequired { get; set; }

        /// <summary>
        /// 是否生成数据库字段
        /// </summary>
        public bool IsCreateDbProp { get; set; }
    }

    public enum ModelType
    {
        [Display(Name ="基础信息模型")]
        BaseModel=0,
        [Display(Name = "搜索条件模型")]
        SearchModel =1,
        [Display(Name = "明细模型")]
        DtlModel =2
    }
}
